#ifndef _WPDATASTRUCT_
#define _WPDATASTRUCT_

struct _WPE_STRING
{
	short		nCount;
	//
	unsigned char		UnknowStr[500 * 5]; // max 500 item, every item max 5 char
	unsigned char		SectionTypeCode[500 * 6]; // max 500 item, every item max 6 char
	unsigned char		ComponentTypeCode[500 * 6]; // max 500 item, every item max 6 char
	unsigned char		ServiceClass[500 * 4]; // every item max 4 char
	
	// material
	unsigned char		MaterialGrade[500 * 8]; //
	unsigned char		MaterialMaterial[500 * 4];
	// 
	double		Length[500]; 
	double		BodyOD[500];
	double		BodyID[500];
	// Joint
	double		JointConnectionOD[500];
	double		JointConnectionID[500];

	// misc
	double		MiscDriftID[500];
	double		MiscWallThicknessPercent[500];
	double		MiscToolJointLength[500];
	double		MiscToolJointLengthOutside[500];
	// Joint
	double		JointAverageJointLength[500];
	//
	double		LinearCapacity[500];
	double		ClosedEndDisplacement[500];
	// misc
	double		MiscStabilizerBladeLength[500];
	double		MiscStabilizerBladeOD[500];

	// ecc
	double		EccBladeLength[500];
	double		EccBladeOD1[500];
	double		EccBladeOD2[500];
	double		EccBladeOD3[500];
	double		EccBladeOD4[500];
	double		EccReference[500];

	// misc
	double		MiscFishneckOD[500];
	double		MiscFishneckLength[500];

	// mwd
	double		MwdFlowRate1[500];
	double		MwdFlowRate2[500];
	double		MwdFlowRate3[500];
	double		MwdFlowRate4[500];
	double		MwdPressureLoss1[500];
	double		MwdPressureLoss2[500];
	double		MwdPressureLoss3[500];
	double		MwdPressureLoss4[500];

	// jar
	double		JarDownSetForce[500];
	double		JarDownTripForce[500];
	double		JarUpSetForce[500];
	double		JarUpTripForce[500];
	double		JarSealFrictionForce[500];
	double		JarPumpOpenForce[500];
	
	// nozzle
	double		NozzleTotalFlowArea[500];
	double		NozzleSize1[500];
	double		NozzleSize2[500];
	double		NozzleSize3[500];
	double		NozzleSize4[500];
	
	short		NozzleCount1[500];
	short		NozzleCount2[500];
	short		NozzleCount3[500];
	short		NozzleCount4[500];

	// mud motor
	double		MudMotorSteeringToolOffset[500];
	double		MudMotorSteeringToolReference[500];
	double		MudMotorSteeringToolBendAngle[500];
	double		MudMotorTopStabilizerOD[500];
	double		MudMotorTopStabilizerLength[500];
	double		MudMotorTopStabilizerDistance[500];
	double		MudMotorBottomStabilizerOD[500];
	double		MudMotorBottomStabilizerLength[500];
	double		MudMotorBottomStabilizerDistance[500];
	double		MudMotorKickPadLength[500];
	double		MudMotorKickPadOffset[500];
	double		MudMotorKickPadOD[500];

	// material
	double		MaterialDensity[500];
	double		ApproximateWeight[500]; // not Material
	double		MaterialMinimumYieldStress[500];
	double		MaterialUltimateTensileStrength[500];
	double		MaterialJointStrength[500];
	double		MaterialConnectionTorsionalYield[500];
	double		MaterialCollapseResistance[500];
	double		MaterialBodyYieldStrength[500];
	double		MaterialInternalYieldPressure[500];
	double		MaterialThermalExpansionCoefficient[500];
	double		MaterialMakeupTorque[500];
	double		MaterialPoissonsRatio[500];
	double		MaterialYoungsModulus[500];
	double		MaterialFatigueEnduranceLimit[500];

	// misc
	double		MiscContactLength[500];
	double		MiscUnderreamerPilotHoleSize[500];
	double		MiscOpenerMaxHoleSize[500];
	double		MiscMisceallaneousTotalFlowArea[500];
	double		MiscPercentBitFlow[500];
	
	short		MiscBitFlowFlag[500];

	// Scraper
	double		ScraperBladeLength[500];
	double		ScraperODExtended[500];
	double		ScraperODRetracted[500];

	// core barrel
	double		CblBladeOD1[500];
	double		CblBladeLength1[500];
	double		CblBladePosition1[500];
	double		CblBladeOD2[500];
	double		CblBladeLength2[500];
	double		CblBladePosition2[500];
	double		CblBladeOD3[500];
	double		CblBladeLength3[500];
	double		CblBladePosition3[500];		// ?????????????BladePosition2???,?��???????
	
	short		CblCoringMode[500];			// ???
	
	double		CblSleeveLength[500];
	double		CblSleeveOD[500];
	double		CblSleeveID[500];

	// misc
	double		MiscRestrictorOD[500];
	double		MiscPassThroughOD[500];
	double		MiscTorqueAtComponent[500];

	// agitator
	double		AgitatorAcceleration[500];
	double		AgitatorFrequency[500];
	double		AgitatorVelocity[500];	
};

struct _WPE_WELLBORE
{
	short		nCount;

	unsigned char		SectionTypeCode[500 * 6];

	double		Length[500];
	double		EffectiveDiameter[500];
	double		DriftDiameter[500];
	double		CoefficientOfFriction[500];
	double		ShoeMD[500];
	double		CasingOD[500];
	double		MinYieldStrength[500];
	double		BurstRating[500];
	double		CollapseRating[500];
	double		WearLimit[500];
	double		AxialRating[500];
};

struct _WPE_FLUID
{
	short		nFluidReadingMethod;
	short		nFluidRheologyModel;

	double		MudWeight[100];

	double		dblPlasticViscosity;
	double		dblYieldPoint;
	double		dblZeroGelStrength;

	// num for fann
	short		FluidTempFanReadingNum[100]; // fluid temperature fann readings num

	double		FannSpeed[100 * 30]; // max fann speed 30
	double		FannReading[100 * 30];

	//
	double		dblShearRate;
	double		dblConsistency;
	double		dblPowerLawExponent;

	// nSeqno for temperature etc
	short		nCount;			// every start 0, maybe it is short, but data align is 8 bytes

	double		Temperature[100];
	double		Pressure[100];
	double		PlasticViscosityArr[100];
	double		YieldPointArr[100];
	double		ZeroGel[100];
	double		MuInfinity[100];
	double		Mvalue[100];
	double		FlowBehaviorIndex[100];
	double		ConsistencyFactor[100];
};

struct _WPE_TEMP
{
	short		nTemperatureFlag;
	short		nModelType;

	float		fSurfaceAmbientTemp;
	float		fMudlineTemp;
	float		fTempAtWellTD;
	float		fFlowlineMudTemp;
	float		fMudGradTempModel;
	// 
	short		nCount;
	double		TempPointTvd[300];
	double		TempPointTemp[300];
};


struct _WPE_FRD
{
	short		nCount;

	double		BottomDistanceFromBit[1000];
	double		CoefficientOfFrictionAxial[1000];
	double		CoefficientOfFrictionRadial[1000];
	double		EffectiveDiameter[1000];
	double		ActualDiameter[1000];
	double		TopDistanceFromBit[1000];
	double		WeightPerUnit[1000];
	double		LengthPerUnit[1000];
	double		WearFactor[1000];
	double		FrictionFactor[1000];

	short		Frequency[1000];
	short		NumberJoints[1000];
	short		Type[1000];
	short		IsFixed[1000];
	short		IsRigid[1000];

	//
	double		StartingForce[1000 * 100]; // max 100 item in every index, index from 0-999
	double		RunningForce[1000 * 100];
	double		RestoringForce[1000 * 100];
	double		SODHoleDiameter[1000 * 100];
	short		ForceCount[1000];
} ;

struct _WPE_CUTTINGS
{
	short		nCuttingsLoadingFlag;
	short		nCuttingDepthsCount;
	short		nBedHeightsCount;

	double		MeasuredDepth[600];
	double		EquivalentMudWeight[600 * 25]; // max 25 item in every index
	double		BedHeight[600 * 25];
} ;


// 320 bytes
struct  _WPE_GELDATA
{
	double		Reading[20];
	double		Strength[20];
};

// 244 bytes
struct _GelPressOutput
{
	short		nCount;

	float		GelStrength[20];
	float		PressureToBreakGel[20];
	float		AnnulusGelPress[20];
};

// 96 bytes
struct _HydFieldBitOpt
{
	float		fMaxPowerPumpRate;			// off_0
	float		fMaxPowerTFA;				// off_4
	float		fMaxPowerAvgNozDia;			// off_8
	float		fMaxPowerPower;				// off_12
	float		fMaxPowerImpactForce;		// off_16
	float		fMaxPowerVelocity;			// off_20
	float		fMaxImpactForcePumpRate;	// off_24
	float		fMaxImpactForceTFA;			// off_28
	float		fMaxImpactForceAvgNozDia;	// off_32;
	float		fMaxImpactForcePower;		// off_36
	float		fMaxImpactForceImpactForce;	// off_40
	float		fMaxImpactForceVelocity;	// off_44

	short		MaxPowerNumJets[4];			// off_48	

	float		MaxPowerNozDia[4];			// off_56

	short		MaxImpactNumJets[4];		// off_72

	float		MaxImpactNozDia[4];			// off_80
};

// 32 bytes
// need debug for data type
struct _WPE_BOOSTER
{
	short		nbooster_pump_flag;
	double		dblinjection_depth;
	double		dblinjection_rate;
	double		dblinjection_temperature;
};

// 24 bytes
struct _WPE_ROUGHNESS
{
	short		nRoughnessFlag;

	double		dblPipeRoughness;
	double		dblAnnulusRoughness;
};

// 8008 bytes
struct _WPE_ECCENTRICITY
{
	short		nEccentricityFlag;

	short		nCount;

	double		Depth[500];
	double		Eccentricity[500];
};

// 304 bytes
struct _WPE_SURFACE
{
	short		nPressureDroCalcType;			// off_0

	double		dblPressureDrop;				// off_8

	short		nEquipmentType;					// off_16	
	short		nEquipmentMode;					// off_18

	double		dblStandPipeLength;				// off_24
	double		dblStandPipeID;					// off_32
	double		dblHoseLength;					// off_40
	double		dblHoseID;						// off_48
	double		dblSwivelLength;				// off_56
	double		dblSwivelID;					// off_64
	double		dblKellyLength;					// off_72
	double		dblKellyID;						// off_80
	double		dblRunLength;					// off_88
	double		dblRunLengthID;					// off_96
	double		dblStackHeight;					// off_104
	double		dblStackHeightID;				// off_112

	short		nWrapType;						// off_120

	double		dblCoreDrumDiameter;			// off_128
	double		dblReelDiameter;				// off_136
	double		dblFlangeHeight;				// off_144
	double		dblInsideWidth;					// off_152
	double		dblReelLength;					// off_160

	short		nUmblicalPresent;				// off_168

	double		dblUmblicalOD;					// off_176
	double		dblTubingOD;					// off_184

	short		nNumPits;						// off_192

	double		dblPitLength;					// off_200
	double		dblPitWidth;					// off_208
	double		dblPitHeight;					// off_216

	short		nUseAverageInletTemperature;	// off_224

	double		dblPitAgitatorPower;			// off_232
	double		dblPitVolumeTotal;				// off_240

	short		nUsePitPercent;					// off_248
	short		nUsePitTotal;					// off_250

	double		dblPitPercent;					// off_256
	double		dblSurfaceMudVolume;			// off_264
	double		dblAirTemperature;				// off_272
	double		dblWindSpeed;					// off_280
	double		dblPitInitialTemperature;		// off_288
	double		dblMudInletTemperature;			// off_296
};

// 7272 bytes
struct _WPE_AFLUID
{
	short		nTemperatureFlag;

	double		dblFluidTemperature;		// need debug to determine data type is float or double, 2023-07-31

	short		nFluidBase;

	double		MeasuredDepth[100];				// off_24
	double		TVD[100];						// off_824
	double		PvTempPipe[100];				// off_1624
	double		MudWeightTempPipe[100];			// off_2424
	double		PvTempAnnulus[100];				// off_3224
	double		MudWeightTempAnnulus[100];		// off_4024
	double		PipeTemp[100];					// off_4824
	double		AvgPipeTemp[100];				// off_5624
	double		AnnulusTemp[100];				// off_6424

	double		dblOilWaterRatio;				// off_7224
	double		dblOilContent;					// off_7232
	double		dblWaterContent;				// off_7240
	double		dblAverageSolidSpgr;			// off_7248
	double		dblSaltWeightPercent;			// off_7256
	double		dblReferenceTemperature;		// off_7264
};

// 24 bytes
struct _WPE_SEARETURNS
{
	short		nReturnsToSea;

	double		dblSeaFloorDepth;
	double		dblSeaWaterPressureGradient;
};
#endif